﻿using System;
public struct ResizableArray<T>
{
    public T[] list;
    public int Length;

    public ResizableArray(int capacity)
    {
        Length = 0;
        list = new T[capacity];
    }
    public void Add(T value)
    {
        if (Length == list.Length)
        {
            int nextCapacity = list.Length * 2;
            var tmp = new T[nextCapacity];
            Array.Copy(list, tmp, list.Length);
        }
        list[Length] = value;
        Length++;
    }

    public void AddRange(T[] list)
    {
        for (int i = 0; i < list.Length; i++)
        {
            Add(list[i]);
        }
    }

    public void Clean()
    {
        Length = 0;
    }
}